<?php
$page = $_GET['Page'];
if(!$page)
	$page = 1;
$cat = $_GET['Cat'];
if(!$cat)
	$cat = 0;
$keyword = $_GET['Keywords'];
if(!$keyword)
	$keyword = "";
$date = $_GET['Date'];
if(!$date)
	$date = "";
$status = 0;
if(!isset($_SESSION['User_F_ID']))
{
	$status = 1;
}else{
	if(!($blog_user['F_ID_USER_INFO'] == $_SESSION['User_F_ID']))
	{
		$status = 2;
	}
}

$list = $blog->GetPostList(1, $cat, $keyword, '', $status, $page, $blog->pagesize, $cat1FID);
$count = $blog->GetPostCount(1, $cat, $keyword, '', $status, $cat1FID);
$pagecount = ceil($count/$blog->pagesize);
if(!$pagecount)
	$pagecount = 1;
?><div id="content"><?php

//输出分页
//echo "<div class=\"pagination cut-off-bottom\">".Page($pagecount,$page,$blog->pagesize,$count)."</div><div id=\"book\">";
echo "<div id=\"book\">";
/**
* 输出文章列表
*/
if($list)
{
	foreach($list as $value)
	{
?><div class="chapter"><h3><span class="option" title="you can opt for turn off the chapter or not"></span><a href="index.php?Action=Post&amp;Post=<?php echo $value['F_ID'] ?>&amp;Cat1=<?php echo $value['F_ID_CAT1'] ?>"><?php echo $value['F_POSTS_TITLE'] ?></a> <span class="date"><?php echo date("Y-m-d",$value['F_POSTS_ISSUE_DATE']) ?></span> <span class="time"><?php echo date("H:i:s",$value['F_POSTS_ISSUE_DATE']) ?></span></h3><div class="chapter-body"><div class="add-ons"><span class="rside"><label><a href="index.php?Action=Post&amp;Post=<?php echo $value['F_ID'] ?>">评论</a>：(<em><?php echo $value['F_POSTS_COMMENTS'] ?></em>)</label> <label>浏览：(<em><?php echo $value['F_POSTS_VIEWS'] ?></em>)</label></span><span><label>分类：<a href="index.php?Cat=<?php echo $value['CatId'] ?>"><?php echo $value['F_CATEGORIES_NAME'] ?></a></label></span></div><div><?php
	//处理文章正文字符串
	$more = '<more>';
	$toMore = strpos($value['F_POSTS_CONTENTS'], $more);
	if($toMore>0){
		$new_contents = substr($value['F_POSTS_CONTENTS'], 0, $toMore)."..."." <a href=\"index.php?Action=Post&amp;Post=".$value['F_ID']."\">阅读全文</a>";
	}else{
		$new_contents = $value['F_POSTS_CONTENTS'];
	}
	echo $new_contents;
?></div></div></div>
<?php
	}
}
//输出分页
echo "</div><div class=\"pagination cut-off-top\">".Page($pagecount,$page,$blog->pagesize,$count)."</div>";

?></div>
<div id="sidebar"><?php require_once("sidebar.php") ?></div>
